UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 's4mgxEGtaOuOWdpUZaNnuft4c0Nn6VwBbtBznGUWyCU='
WHERE
key_id = 'daf000a18faabba10aa7230c691d9d391d437c27b4aad6cdd0db3c505ea907af'
AND (
token = 's4mgxEGtaOuOWdpUZaNnuft4c0Nn6VwBbtBznGUWyCU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)