UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f3wrnSuJsbqKG0goFE+eajFzCpM0brUbHenFzmTH514='
WHERE
key_id = '1b9faefacb764b6992037a4101f4c9d89b3b349ec251d49710f4bd1a0a172dcf'
AND (
token = 'f3wrnSuJsbqKG0goFE+eajFzCpM0brUbHenFzmTH514='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)