UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tJGFtzYiAJUeWgMA1GAScNkLGBmCHCl4kB5xqES/9Fc='
WHERE
key_id = 'fd625ff9d23c017d34c3d173d4e0dba9151680a73789f85020e94486085272e4'
AND (
token = 'tJGFtzYiAJUeWgMA1GAScNkLGBmCHCl4kB5xqES/9Fc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)