UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qsRTN4F2MJvY6e4TYgarHv95f3uMzoBpwp7en9H+Gwk='
WHERE
key_id = '6e99a9a4dc1ea5a12765dca9e3f439a5845b0b152153895d47f604e0baf07ef3'
AND (
token = 'qsRTN4F2MJvY6e4TYgarHv95f3uMzoBpwp7en9H+Gwk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)