UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1jjH7xdR2v6sdqawXLtQdqd7ZKyosU+a2rnkYzcCFDs=' 
WHERE 
  key_id = '6dd02abddd4f42b8f2c732b8e9951dd29585b97e6595f0bcdcf7760fcc3935b7' 
  AND (
    token = '1jjH7xdR2v6sdqawXLtQdqd7ZKyosU+a2rnkYzcCFDs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044