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