UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qSSFXhT80bsJfWHaptZ7Cv08efmLxioFJaYczBh4+Ws='
WHERE
key_id = 'b619b3a8f41a0cc099feaa7881d0dc77ceb2ef6f20975a525e7b223e661927fa'
AND (
token = 'qSSFXhT80bsJfWHaptZ7Cv08efmLxioFJaYczBh4+Ws='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)