UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+epcQuAHD4viy6QYThZtEHTQ0lE0vwfOCi7qGEbQE6E='
WHERE
key_id = '51ac584598bdbb77cc6474e7478da410f7cb6e195c387ff3d222ce7cf463b19f'
AND (
token = '+epcQuAHD4viy6QYThZtEHTQ0lE0vwfOCi7qGEbQE6E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)