UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6T8QL5A7bv9oLFESxhDvO6StQqibR+qs1xYj+XH7yU0='
WHERE
key_id = 'ed085ea3d3c25138365650c51961a0d05b1352f5d9665845f1b270b831b8ff7f'
AND (
token = '6T8QL5A7bv9oLFESxhDvO6StQqibR+qs1xYj+XH7yU0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)