UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lAzYMw3ZUxuOLlxgHTY+Fc50t4aRs9E1gAblMEVCgPo=' 
WHERE 
  key_id = '68993804421fcc7409a7d88d5f800c09f8d82391745a2af919fc01295dee5815' 
  AND (
    token = 'lAzYMw3ZUxuOLlxgHTY+Fc50t4aRs9E1gAblMEVCgPo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042