UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Cr2KGjeiHFdb6gbfPMOq8KuZB5vd81dgCX2XHN0Gnh4='
WHERE
key_id = '7294ca219ca4b158cbf4adccfa369d7335519c59853e15e046dbb7d695c32771'
AND (
token = 'Cr2KGjeiHFdb6gbfPMOq8KuZB5vd81dgCX2XHN0Gnh4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)