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

Query time 0.00032