UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F4WFAdeSUc9Y3cbmtpACmJngc+lWV0LkMuFnksX21l8=' 
WHERE 
  key_id = '8c5a0511223ab41e11323490ae987599c4c950a0b981afa1361a59b57bc5de78' 
  AND (
    token = 'F4WFAdeSUc9Y3cbmtpACmJngc+lWV0LkMuFnksX21l8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016