UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lyvb9uWCLgucXY8K3vKsKHSt8nRJ1FfQOGzNjZ1zgdk=' 
WHERE 
  key_id = 'e7d91f8f43efeb8ca83adcb9c054c29707d201f7a7c0bcb258293c80fade6526' 
  AND (
    token = 'lyvb9uWCLgucXY8K3vKsKHSt8nRJ1FfQOGzNjZ1zgdk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033