UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NSMuYoBMauyXfYGQTWWi3wffW16hJTH+lfB2Y1w8V64='
WHERE
key_id = '4cc7afadfa3f849fd540dd5456f276317cfc7e94c57016b44071940f83ab3cd8'
AND (
token = 'NSMuYoBMauyXfYGQTWWi3wffW16hJTH+lfB2Y1w8V64='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)