UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cGfAst5yCOp8o0Ht6lsOX12m/pIltOiEYAqQerHArj8=' 
WHERE 
  key_id = '40ed33430422417a42b04060b5b211715f0a7eecfa14a227e534fa87d4aa97f7' 
  AND (
    token = 'cGfAst5yCOp8o0Ht6lsOX12m/pIltOiEYAqQerHArj8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027