UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HuA5cexRY3SmVQggMpLYh+wA5xyW7UfmuEAVsH+tUrk=' 
WHERE 
  key_id = 'd638294e090e2ee31d4501a3b63f681976174af7d1959804336064b22ea46e18' 
  AND (
    token = 'HuA5cexRY3SmVQggMpLYh+wA5xyW7UfmuEAVsH+tUrk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015