UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gUDivQvDthFnQTOEgX2r6kSKEYm/FM6kUNITq7uz0dA='
WHERE
key_id = 'a19632d2f38c53df59051a88cce7aa6f67bf21a40274d7db4a66c4551a896821'
AND (
token = 'gUDivQvDthFnQTOEgX2r6kSKEYm/FM6kUNITq7uz0dA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)