UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z5PEmL+oMvUe72K7rMIvXipG+f+tkxOjYsMIEDY9TUM='
WHERE
key_id = '38ce7490d7565cd8a945c5add9f834fbe37b572bd5e025d928f0a96f10d560a7'
AND (
token = 'Z5PEmL+oMvUe72K7rMIvXipG+f+tkxOjYsMIEDY9TUM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)