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

Query time 0.00031