UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kYiF5VTo4M2D1f7MZasV8AkhK9dleYityHdztsnepZ4=' 
WHERE 
  key_id = '10116bc2545fbb2782b7536e6bde2e7b4c51188e2de6e843444b937e73e110bf' 
  AND (
    token = 'kYiF5VTo4M2D1f7MZasV8AkhK9dleYityHdztsnepZ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028