UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aT4I3/qHpxRLg75j5FzsBuKmmxYhn6/xsYPG9ixo46s='
WHERE
key_id = 'a57a316bb8ab303082272438ed0fe646b843e155ee697d151b8fef00bc6adb61'
AND (
token = 'aT4I3/qHpxRLg75j5FzsBuKmmxYhn6/xsYPG9ixo46s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)