UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V8i0T9Ph8wF6R3aT0g1M88kUdW8vI7OQV4gYsnw7XOo=' 
WHERE 
  key_id = '16f1c2372b86907859c97184bf855a739854cdcec33ff55cc35c89e4a96f7ab3' 
  AND (
    token = 'V8i0T9Ph8wF6R3aT0g1M88kUdW8vI7OQV4gYsnw7XOo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031