UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AfGS4hN3ToOXsiMh9jRIbm4kCqEw9ItaC5qp7L+C3P0='
WHERE
key_id = '64a3d1f778ca60a9701f24d44c66c0d313881dcec5929fccfe33d8262af9fa49'
AND (
token = 'AfGS4hN3ToOXsiMh9jRIbm4kCqEw9ItaC5qp7L+C3P0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)