UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x+PhVq0ZPvx2aK7rtYaIPTGC23SXpCgISKWbgLquOeA=' 
WHERE 
  key_id = '7f0c324241fdc978ac22f5df23067bf39e73779b360995e2bf1e5ff9e74f843e' 
  AND (
    token = 'x+PhVq0ZPvx2aK7rtYaIPTGC23SXpCgISKWbgLquOeA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032