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

Query time 0.00026