UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'muwHs+vYQTfifguNnyEfg3Y6t+ieJLkpangDsF/gt/I=' 
WHERE 
  key_id = '1301ac1811763c7c144630c17520f8f355314df9452e4819fdda715a8ce4d893' 
  AND (
    token = 'muwHs+vYQTfifguNnyEfg3Y6t+ieJLkpangDsF/gt/I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056