UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iX+JA5ddx9bHLxCPa0JpuY+hd7vz82Xbo23WBg4Ed4M=' 
WHERE 
  key_id = '8038090c837580ed5f4e78681b7da386ff1da4902b95b47b1bd0e5b21ec1fa15' 
  AND (
    token = 'iX+JA5ddx9bHLxCPa0JpuY+hd7vz82Xbo23WBg4Ed4M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017