UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fg9c7EwUudyqKPtVfe6lf3Xv4FUflkF0/+SaUkKCTcs='
WHERE
key_id = '9a7f2b281683a19b6af945aba5d944e7c6b52a9cde7c51d6e9b7e094ee67b307'
AND (
token = 'fg9c7EwUudyqKPtVfe6lf3Xv4FUflkF0/+SaUkKCTcs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)