UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hvOCFlK6HLsFVGsRvb3kBosPLaRygBFymld1miaflcg=' 
WHERE 
  key_id = '53704323270e2e919c47445b7318c79e9bab9e9925eeb243f1920b34411a61df' 
  AND (
    token = 'hvOCFlK6HLsFVGsRvb3kBosPLaRygBFymld1miaflcg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043