UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mak9kn58uDHlfYLQi/SCxB7X/w/yM9g7CQPAMChJrho=' 
WHERE 
  key_id = '252fe4d338ae3f564e7b905eedda74035206c62245782c7f82f2cecacbd33a3d' 
  AND (
    token = 'mak9kn58uDHlfYLQi/SCxB7X/w/yM9g7CQPAMChJrho=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026